# include <bits/stdc++.h>
# define N 150005
using namespace std;
int n,m,Q;
int a[N];
long long sum[N];
pair<int,int> s[N];
int hd,tl;
int main()
{
    freopen("clear.in","r",stdin);
    freopen("clear.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>n>>m>>Q;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    for(int i=1;i<=n;i++)
        sum[i]=sum[i-1]+a[i];
    while(Q--)
    {
        int l,r;
        cin>>l>>r;
        if(m==1)
            cout<<sum[r]-sum[l-1]<<'\n';
        else
        {
            long long ans=0;
            hd=1,tl=0;
            long long now=0;
            for(int i=l;i<=r;i++)
            {
                while(hd<=tl && i-s[hd].first>=m)
                    now-=s[hd].second,hd++;
                while(now>a[i])
                    if(s[hd].second<=now-a[i])
                    {
                        now-=s[hd].second;
                        hd++;
                    }
                    else
                    {
                        s[hd].second-=now-a[i];
                        now=a[i];
                        break;
                    }
                if(now<a[i])
                    ans+=a[i]-now,s[++tl]={i,a[i]-now},now=a[i];
            }
            cout<<ans<<'\n';
        }
    }
    return 0;
}